Skip to content

Ignore unknown dismissed message names when loading application state - #20865

Open
frabcd wants to merge 3 commits into
microsoft:mainfrom
frabcd:codex/fix-unknown-dismissed-messages
Open

frabcd wants to merge 3 commits into
microsoft:mainfrom
frabcd:codex/fix-unknown-dismissed-messages

Conversation

@frabcd

@frabcd frabcd commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary of the Pull Request

Unknown dismissed-message names can throw through ApplicationState::FromJson and terminate startup. Treat them as ignored entries and omit them when saving. Remove the obsolete name mappings.

Closes #16874.

Validation

One regression test loads an unknown name alongside closeOnExitInfo, then checks that only the known dismissal is saved.

  • The matching supplemental converter check fails against both earlier implementations and passes against the fix. It uses real JsonCpp with a substitute for the WinRT collection, so it does not cover native integration.
  • Native SettingsModel tests could not run locally: the built TAEF runner is unavailable.

Prepared with AI assistance.

Map unrecognized InfoBarMessage names to the existing deprecated sentinel
so they cannot throw through ApplicationState::FromJson during startup.
Add regression coverage for mixed names and state serialization.

Fixes microsoft#16874
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@frabcd

frabcd commented Oct 28, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@frabcd
frabcd marked this pull request as ready for review October 28, 2026 15:58
@frabcd

frabcd commented Oct 29, 2026

Copy link
Copy Markdown
Author

Hi Dustin L. Howett (@DHowett)! Would you mind taking a look at this PR when you have a chance?
It fixes #16874 and includes a regression test. Some Azure Pipelines checks may also need maintainer authorization.
Happy to address any feedback. Thanks!

Comment on lines 610 to 612

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your fix is incomplete, as it doesn't remove these entries


JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage)
{
ValueType FromJson(const Json::Value& json)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the deserializer. What about ToJson? We should be able to prevent serializing IgnoredDeprecatedEntry altogether.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 2, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 4, 2026

@lhecker Leonard Hecker (lhecker) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM.

Comment on lines +86 to +89
// Invalid names must not prevent fields before or after this one from loading.
VERIFY_ARE_EQUAL(L"test-hash", state->SettingsHash());
VERIFY_ARE_EQUAL(1u, state->AllowedCommandlines().Size());
VERIFY_ARE_EQUAL(L"test-command", state->AllowedCommandlines().GetAt(0));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you shrink the tests to just spot check the core issue to protect against future regressions?

(You got to really reign in your LLM when it comes to tests - they always tend to write overly defensive / broad tests. 😅)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah 😅 I'll fix the tests and keep them focused on the bug. Thanks!

@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If state.json contains any unknown dismissed message keys, we crash

3 participants